<template>
  <div class="container">
    <el-form :model="searchList" ref="searchList" size="normal">
      <el-row :gutter="20">
        <el-col :span="6" :offset="0">
          <el-form-item label="">
            <el-input v-model="searchList.company_name" placeholder="请输入单位名称" clearable></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6" :offset="0">
          <el-form-item label="">
            <el-input v-model="searchList.project_name" placeholder="请输入项目名称" clearable></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6" :offset="0">
          <el-form-item label="">
            <el-select v-model="searchList.status" value-key="status" placeholder="项目状态" clearable class="wid">
              <el-option v-for="item in projectStatus" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6" :offset="0">
          <div class="right">
            <el-button type="primary" size="medium" @click="search" :loading="loading">查询</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>

    <el-table :data="tableData.results" border stripe :height="offsetHeight" v-loading="loading">
      <el-table-column type="index" label="序号" width="60" align="center">
      </el-table-column>
      <el-table-column prop="ensure_dept" label="保障部门" width="80" align="center">
      </el-table-column>
      <el-table-column prop="company_name" label="单位名称" align="center">
      </el-table-column>
      <el-table-column prop="project_name" label="项目名称" align="center">
      </el-table-column>
      <el-table-column prop="status" label="项目状态" width="120" align="center" v-show="searchList.status <3">
      </el-table-column>
      <el-table-column prop="internal_code_log" label="已审核内设部门" align="center" v-show="searchList.status == 3">
      </el-table-column>
    </el-table>
    <div class="page">
      <el-pagination @size-change="pageSizeChange" @current-change="pageNoChange" :page-sizes="[10, 50, 100, 200]"
        :page-size="10" background layout="total, sizes, prev, pager, next" :total="tableData.totalRecord">
      </el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  name: 'PastDeclaredApplyProject',
  components: {
  },
  props: {

  },
  data () {
    // 获取当前年份
    let now = new Date().getFullYear().toString()
    return {
      loading: false,
      saveLoading: false,
      searchList: {
        apply_batch: now
      },
      tableData: [],
      offsetHeight: document.documentElement.clientHeight - 230,
      pageNo: '1',
      pageSize: '10',
      projectStatus: [
        { value: '0', label: '本单位录入' },
        { value: '1', label: '本单位审核' },
        { value: '2', label: '保障部门审核' },
        { value: '3', label: '内设部门审核' },
        { value: '4', label: '咨询机构审核' },
      ]
    }
  },
  created () {

  },
  mounted () {
    this.init()
  },
  methods: {
    async init () {
      this.loading = true
      const res = await this.$http('historySBporjectPage', {
        pageNo: this.pageNo,
        pageSize: this.pageSize,
        ...this.searchList
      })
      this.tableData = res
      this.loading = false
    },
    search () {
      this.pageNo = 1
      this.pageSize = 10
      this.init()
    },
    pageNoChange (pageNo) {
      this.pageNo = pageNo
      this.init()
    },
    pageSizeChange (pageSize) {
      this.pageSize = pageSize
      this.init()
    },
  },
  computed: {

  }
}
</script>
<style lang='scss' scoped>
</style>
